package jude.java.money;

import java.io.IOException;

import jude.java.util.WebUtils;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.params.ClientPNames;


public class Test {
	
	public static void main(String[] args) throws ClientProtocolException, IOException {
		test();
	}
	
	static void test() throws ClientProtocolException, IOException {
		HttpClient client = WebUtils.getHttpClient();
		HttpGet get = new HttpGet("http://setrade.tk/");
		client.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, Boolean.FALSE);
		get.getParams().setBooleanParameter(ClientPNames.HANDLE_REDIRECTS, Boolean.TRUE);
		HttpResponse response = client.execute(get);
		String resp = WebUtils.getResponse(response, 0, "UTF-8");
		System.out.println(resp);
		System.out.println(response.getStatusLine().getStatusCode());
	}
}